<?php
defined('JSJZJX')||exit('JSJZJX Denied');
class RbacModel extends Model{
	protected $table = "role_user_info";
	protected $fields = array('role_id','user_id');

	/*
	*查询当前用户的角色
	**/
	function selectRole($uname){
		$sql = "select name,a.role_id from kq_role_user as a,kq_role b,kq_user as c 
		where a.role_id=b.role_id and a.user_id=c.uid and c.uname='".$uname."'";
		return $this->db->getRow($sql);
	}
	
	/*
	*查询当前用户的权限
	**/
	function selectNode($role_id){
		$sql = "select b.id,b.name,b.title,b.status,b.pid,b.level from kq_access as a,kq_node b,kq_role as c 
		where a.role_id=c.role_id and a.node_id=b.id and c.role_id=".$role_id;
		return $this->db->getAll($sql);
	}


}
?>